import ApiService from './apiService.js';

// 项目API服务
class ProjectService extends ApiService {
  constructor() {
    super('project');
  }

  // 获取项目列表
  getProjectList(params) {
    return this.request({
      method: 'get',
      url: '/project/list',
      params
    });
  }

  // 获取项目详情
  getProjectDetail(id) {
    return this.request({
      method: 'get',
      url: `/project/detail/${id}`
    });
  }

  // 保存项目供应商关联
  saveProjectSupplier(data) {
    return this.request({
      method: 'post',
      url: '/project/save-supplier',
      data
    });
  }
}

// 供应商API服务
class SupplierService extends ApiService {
  constructor() {
    super('supplier');
  }

  // 获取供应商列表
  getSupplierList(params) {
    return this.request({
      method: 'get',
      url: '/supplier/list',
      params
    });
  }

  // 获取供应商详情
  getSupplierDetail(id) {
    return this.request({
      method: 'get',
      url: `/supplier/detail/${id}`
    });
  }
}

// 导出服务实例
export const projectService = new ProjectService();
export const supplierService = new SupplierService(); 